/*
 * @Description:获取产监3.0项目配置
 * @Author: liyuhao
 * @Date: 2022-06-13 16:10:12
 * @LastEditors: liyuhao
 * @LastEditTime: 2022-06-13 16:10:19
 */
import {useEffect, useState} from 'react'
import {getProjectConfig, setProjectConfig} from '@/utils/authority'
import {getAppInfo} from "@/services/usercenter.ts";

const useProjectConfig: any = () => {
    const projectConfig = getProjectConfig();
    const [config, setConfig] = useState<any>(projectConfig)

    useEffect(() => {
        if (!projectConfig) {
            getAppInfo().then((res: any) => {
                setProjectConfig(res);
                setConfig(res);
            })
        }
    }, [])

    return config
}

export default useProjectConfig
